/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class RetrieveAndUpdateVotoElectronicoData {
	public void retrieveAndUpdateTestData() throws PersistentException {
		PersistentTransaction t = orm.VotoElectronicoPersistentManager.instance().getSession().beginTransaction();
		try {
			orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
			orm.dao.CandidatoDAO lormCandidatoDAO = lDAOFactory.getCandidatoDAO();
			orm.Candidato lormCandidato = lormCandidatoDAO.loadCandidatoByQuery(null, null);
			// Update the properties of the persistent object
			lormCandidatoDAO.save(lormCandidato);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public void retrieveByCriteria() throws PersistentException {
		System.out.println("Retrieving Candidato by CandidatoCriteria");
		orm.CandidatoCriteria candidatoCriteria = new orm.CandidatoCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//candidatoCriteria.id.eq();
		System.out.println(candidatoCriteria.uniqueCandidato());
		
	}
	
	
	public static void main(String[] args) {
		try {
			RetrieveAndUpdateVotoElectronicoData retrieveAndUpdateVotoElectronicoData = new RetrieveAndUpdateVotoElectronicoData();
			try {
				retrieveAndUpdateVotoElectronicoData.retrieveAndUpdateTestData();
				//retrieveAndUpdateVotoElectronicoData.retrieveByCriteria();
			}
			finally {
				orm.VotoElectronicoPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
